<?php

namespace App\Http\Controllers\applet_api;

use App\Http\Controllers\Controller;
use App\Models\Train;
use Illuminate\Http\Request;

class TrainController extends Controller
{
    public function index()
    {
        $data = Train::select('id','cover','title','start_time','start_time','surplus','number')->orderBy('id','desc')->get();
        return response()->json(['code' => '200', 'msg' => 'success','data'=>$data]);
    }

    public function info(Request $Request)
    {
        $data = Train::find($Request->id);
        $data->contents = str_replace('src="/ueditor/php/upload','src="https://gl.xinzhuvip.com/ueditor/php/upload',$data->contents);
        $data->is_sign;
        return response()->json(['code' => '200', 'msg' => 'success','data'=>$data]);
    }
}
